﻿using System;
using System.Collections.Generic;
using System.Text;

namespace GFC
{
    [Serializable]
    public class ValueDependantField : ConditionalField
    {
        private object m_DependacyValue;

        protected ValueDependantField()
        {
        }

        public ValueDependantField(Frame frame, string name, int size, FieldType type, string dependancyFieldName, object dependancyValue) :
            base(frame, name, size, type, dependancyFieldName)
        {
            this.DependacyValue = dependancyValue;
        }

        public object DependacyValue
        {
            get { return m_DependacyValue; }
            set { m_DependacyValue = value; }
        }

        public override bool Equals(object obj)
        {
            ValueDependantField field = obj as ValueDependantField;
            if (field == null)
                return false;
            return base.Equals(obj) && this.DependacyValue.Equals(field.DependacyValue);
            //TODO: MAKE SURE THIS EQUALS CALL ACTUALLY PERFORMS A DEEP COPY!
        }
    }
}
